package socket;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;

/**
 * User: heihaier@xfuweng.com
 * Date: 2015/7/8
 * Time: 15:09
 */
public class MyClient2 {

    public static void main(String[] args) {

        try {
            Socket socket = new Socket("127.0.0.1", 1111);
            new Thread(new ClientThread(socket)).start();
            PrintStream ps = new PrintStream(socket.getOutputStream());
            String line = null;
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            while ((line = br.readLine()) != null) {
                ps.println(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
